const express = require("express")
const mongoose = require('mongoose')
const bodyParser = require('body-parser')
const passport = require('passport')
const patient = require('./router/api/patient')
const myorder = require('./router/api/myorder')
const msgcard = require('./router/api/msgcard')
const app = express();
mongoose.connect('mongodb://localhost/health_server')
    .then(() => console.log('数据库连接成功'))
    .catch(err => console.log(err, '连接失败'))
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.use(passport.initialize())
app.use('/user/patient',patient)
app.use('/user/myorder',myorder)
app.use('/user/msgcard',msgcard)
require('./config/passportbulid')(passport)
const port = process.env.PORT || 7000;
app.listen(port, () => {
    console.log(`服务器已启动 ${port}`)
})